<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div>
<h1>身体质量指数测试</h1>
<input type="text" v-model="height"   placeholder="请输入身高(单位:米)">
<input type="text"  v-model="weight" placeholder="请输入体重(单位:公斤)">

<input type="submit" value="开始测试" @click="f()">
<h2>{{info}}</h2>
</div>
</body>
<script src="https://cdn.staticfile.org/vue/2.2.2/vue.min.js"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/axios/0.21.1/axios.min.js"></script>
<script>
    let v = new Vue({
        el: "body>div",
        data: {
            height: "",
            weight: "",
            info: ""
        },
        methods: {
            f() {
                //http://localhost:8080/reg?username+=lmk&password+=wtwtwtwet&nick+=wkj
                //发送异步请求//localhost:8080/bmi.html?h=****&w=***
                axios.get("bmi?h=" + v.height + "&w=" + v.weight).then(function (response) {
                    v.info = response.data;
                })

            }

        }
    })
</script>
</html>